const isJSON = require('./isJSON')

const mergeJSON = (minor, main) => {
  for (var key in minor) {

    if (isJSON(minor[key])) {
      if(!main[key])
        main[key] = {}
      mergeJSON(minor[key], main[key]);
      continue
    }
    main[key] = minor[key]


  }

  return main
}

module.exports = mergeJSON
